package com.cn.longdistancebusstation.enumxx;

/**
 * Created by mal on 2018/1/24.
 */

public enum PassengerType {
    PASSENGER_ADULT(0, "成人"),
    PASSENGER_CHILD(1, "儿童"),
    PASSENGER_STUDENT(2, "学生"),
    PASSENGER_SOLIDER(3, "军人");

    public int code;
    public String desc;

    PassengerType(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static PassengerType getPassengerType(int type){
        for(PassengerType passengerType:values()){
            if(type == passengerType.code){
                return passengerType;
            }
        }
        return PASSENGER_ADULT;
    }
}
